<%@ page language="java" contentType="text/html; charset=UTF-8" 
    pageEncoding="UTF-8"%>
<div title="详细信息"  style="width:700px;height:400px;padding:10px 20px;">
	<div class="ftitle">合同信息</div>
	<div class="cdetail">
				<div class="fitem">
					<span class="view_customer12">客户: <span id="view_customer"></span></span>
				</div>
        		<div class="fitem">
            		<span class="view_customer12">商业机会 : <span id="view_opportunity"></span></span>
            	</div>
            	<div class="fitem">
            		<span class="view_customer11">价格: <span id="view_price"></span></span>
            		<span class="view_customer11">状态: <span id="view_strategy"></span></span>
            		<span class="view_customer11">手术时间: <span id="view_time"></span></span>
            	</div>
            	<div class="fitem">
            		<span class="view_customer11">添加人 : <span id="view_createUser"></span></span>
            		<span class="view_customer11">添加时间 : <span id="view_createTime"></span></span>
            	</div>
            	<div class="ftitle">电子合同</div>
            	<div class="fitem" id="didContract">
            	</div>
            	<div class="ftitle">详细内容</div>
            	<div class="fitem">
            		<span id="view_content"></span>
            	</div>
   </div>
</div>
<script type="text/javascript">
(function( viewContractJs, $, undefined ) {
	
	viewContractJs.init = function(){
		workbenchJs.loadData("dispatch/customer/contract/query?id="+getID(),viewContractJs.loadContractResult,"查询手术合同");
	};
	function getID(){
		return <%=request.getParameter("id")%>;
	}
	function setStrategyFormat(value){
		if(value == 'processing')
			return "进行中";
		if(value == 'success')
			return '完成';
		if(value == 'failed')
			return '已取消';
	}
	
	viewContractJs.loadContractResult = function(result){
    	
        	var payload = jQuery.parseJSON(result.payload.value);
        	$('#view_customer').html(payload.customerName);
        	$('#view_opportunity').html(payload.opportunityName);
        	
        	$('#view_price').html(payload.price);
        	$('#view_time').html(payload.time);
        	$('#view_createUser').html(payload.createUser);
        	$('#view_createTime').html(payload.createTime);
        	
        	$('#view_content').html(payload.note);
        	$('#view_file').html(payload.contractAttachment);
        	$('#view_strategy').html(setStrategyFormat(payload.strategy));
        	
        	if(payload.contractAttachment != undefined && payload.contractAttachment != '')
        	{
        		$('#didContract').html('<a href="'+payload.contractAttachment+'">电子合同</a>');
        	}
	}
}( window.viewContractJs = window.viewContractJs || {}, jQuery ));

$(function(){
	viewContractJs.init();
});
</script> 
<style type="text/css">
    .view_customer11{
        margin-bottom:5px;
        margin-left:9px;
        display:inline-block;
        width:200px;
    }
    .view_customer12{
        margin-bottom:5px;
        margin-left:9px;
        display:inline-block;
        width:250px;
    }
     .ftitle{
            font-size:14px;
            font-weight:bold;
            padding:5px 0;
            margin-bottom:10px;
            border-bottom:1px solid #ccc;
        }
        .fitem{
            margin-bottom:5px;
        }
        .fitem label{
            display:inline-block;
            width:80px;
        }
</style>